﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="../scripts/boot.js" type="text/javascript"></script>
    <script type="text/javascript">
        $.ajax({
            url: "../data/system.aspx?method=1509",
            async: false,
            success: function (text) {
                if (text == "no")
                    window.location = "error.html";
                else if (text == "out") {
                    var loginWindow = parent.mini.get("loginWindow");
                    if (!loginWindow.visible)
                        loginWindow.show();
                    var tabs = parent.mini.get("mainTabs");
                    var tab = tabs.getTab("tab$1509");
                    tabs.removeTab(tab);
                }
            }
        });
    </script>
</head>
<body>
    <div class="mini-toolbar" style="border-bottom: 0;">
        <table>
            <tr>
                <td>
                    关键字：
                    <input class="mini-textbox" id="key" emptytext="关键字" />
                    类型：
                    <input id="state" class="mini-combobox" style="width: 60px;" data="LogType" value="0"/>
                    <a class="mini-button" iconcls="icon-search" plain="true" onclick="search();">查询</a>
                </td>
            </tr>
        </table>
    </div>
    <div class="mini-fit" >
        <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" allowresize="true"
            idfield="id" url="../data/system.aspx?method=GetSyslogList" sizeList="[15,20,50,100]" pageSize="15">
            <div property="columns">
                <div type="indexcolumn"></div>
                <div field="su_login" width="100px" headeralign="center" align="center" allowsort="true" renderer="onNameRenderer">
                    操作人</div>
                <div field="sl_type" width="50px" headeralign="center" align="center" allowsort="true" renderer="onLogTypeRenderer">
                    类型</div>
                <div field="sl_time" width="100px" headeralign="center" align="center" allowsort="true" dateformat="yyyy-MM-dd HH:mm:ss">
                    操作时间</div>
                <div field="sl_ip" width="100px" headeralign="center" align="center" allowsort="true">
                    操作IP</div>
                <div field="sl_memo" width="300px" headeralign="center" align="left" allowsort="true">
                    操作内容</div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $.ajaxSetup({
            contentType: "application/x-www-form-urlencoded;charset=utf-8",
            complete: function (XMLHttpRequest, textStatus) {
                // 通过XMLHttpRequest取得响应头，sessionstatus
                var sessionstatus = XMLHttpRequest.getResponseHeader("sessionstatus");
                if (XMLHttpRequest.responseText == "out") {
                    var loginWindow = parent.mini.get("loginWindow");
                    if (!loginWindow.visible)
                        loginWindow.show();
                }
            }
        });

        mini.parse();
        var grid = mini.get("datagrid1");
        search();

        function search() {
            var state = mini.get("state").getValue();
            var key = mini.get("key").getValue();
            grid.load({ state: state, key: key });
            grid.sortBy("sl_no", "desc");
        }

        //日志显示
        function onNameRenderer(e) {
            var s = '<a class="linelink" title="查看该用户操作日志" href="javascript:void(0);" onclick="lookRows(' + e.record._uid + ')">' + e.value + '</a>';
            return s;
        }

        //查看日志
        function lookRows(row_uid) {
            var row = grid.getRowByUID(row_uid);
            if (row) {
                var tabs = parent.mini.get("mainTabs");
                var tab = tabs.getTab("tab$1509");
                tab.enabled = false;
                showRTab(row.sl_man);
            }
        }

        //打开日志Tab
        function showRTab(su_no) {
            var tabs = parent.mini.get("mainTabs");
            var id = "tab$log";
            var tab = tabs.getTab(id);
            if (!tab) {
                tab = {};
                tab.name = id;
                tab.title = "查看日志";
                tab.showCloseButton = true;
                tab.url = "system/log.html?suno=" + su_no;
                tabs.addTab(tab);
            }
            tabs.activeTab(tab);
        }
    </script>
</body>
</html>